<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<% String path = request.getContextPath();%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script src="<%=path%>/static/js/jquery-3.5.1.min.js"></script>
<jsp:include page="/manage/inc/header"/>
<jsp:include page="/manage/inc/menu"/>
<script>
    $(function () {
        var pageNumber = 1;
        var id = null;
        var username = null;
        var sex = null;
        var content = null;
        initdate(pageNumber,id,username,sex,content);

        $(".result-content").on("click",".list-page a",function () {
            pageNumber = $(this).data("pagenum");
            initdate(pageNumber,id,username,sex,content);
        });
        //搜索
        $("#search").click(function () {
            id = $("#rows").val();
            username = $("#username").val();
            sex = $("#sex").val();
            content = $("#content").val();
            initdate(pageNumber,id,username,sex,content);
        });
        //批量删除
        $("#batchDel").click(function () {
            var idArr = new Array();
            $(":checked[id=choose]").each(function () {
                idArr.push($(this).val());
            });
            if (idArr.length>0){
                $.get("<%=path%>/manage/comment/batchDel",{idArr:idArr.toString()},function () {
                    $(":checked[id=choose]").parent().parent().remove();
                });
            }
        });
       /* $(".result-content").on("click",".link-update",function () {
            var id = $(this).attr("id");
            $.get("<%=path%>/manage/comment/reply",{id:id});
        });*/
    });
    function initdate(pageNumber,id,username,sex,content){
        $.get("<%=path%>/manage/comment/date",{pageNumber:pageNumber,id:id,username:username,sex:sex,content:content},function (resource) {
            $(".result-content").html(resource);
        });
    }
</script>
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="<%=path%>/manage/index">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">评论管理</span></div>
        </div>
        <div class="search-wrap">
            <div class="search-content">
                <table class="search-tab">
                    <tr>
                        <th width="120">选择职位:</th>
                        <td>
                            <select name="search-sort" id="rows">
                                <option value="">全部</option>
                              <c:forEach items="${requestScope.jobs}" var="job">
                                  <option value="${job.id}">${job.name}</option>
                              </c:forEach>
                            </select>
                        </td>
                        <td><input class="common-text" placeholder="用户名" id="username" type="text"></td>
                        <td><input class="common-text" placeholder="内容" id="content" type="text"></td>
                        <td><input class="common-text" placeholder="性别" id="sex" type="text"></td>
                        <td><input class="btn btn-primary btn2" id="search" value="查询" type="button"></td>
                    </tr>
                </table>
            </div>
        </div>
        <div class="result-wrap">

                <div class="result-title">
                    <div class="result-list">
                        <a id="batchDel" href="javascript:void(0)"><i class="icon-font"></i>批量删除</a>
                    </div>
                </div>
                <div class="result-content">

                </div>

        </div>
    </div>
    <!--/main-->
</div>
<jsp:include page="/manage/inc/footer"/>
